﻿using Bingosoft.Data;
using Bingosoft.Security;
using System.Web;
using HHMMS.Core;
using HHMMS.Core.Model;
using HHMMS.Core.Service;

namespace System
{
    /// <summary>
    /// 安全上下文用户信息扩展方法
    /// </summary>
    public static class UserExtensions
    {
        /// <summary>
        /// 退出登录时清掉用户缓存信息。
        /// </summary>
        /// <param name="user"></param>
        public static void SignOut(this Bingosoft.Security.Principal.IUser user)
        {
            string cacheKey = string.Format(Const.CACHE_KEY_USER_OWNER, user.LoginId);
            HttpRuntime.Cache.Remove(cacheKey);
        }
    }
}
